import fs from "fs";

const versionPath = "public/version.json"
const versionInfo = {
  version: new Date().getTime()
}

try {
  if (fs.existsSync(versionPath)){
    const existData = JSON.parse(fs.readFileSync(versionPath, 'utf-8'))
    existData.push(versionInfo)
    fs.writeFileSync(versionPath, JSON.stringify(existData), 'utf-8')
  } else {
    fs.writeFileSync(versionPath, JSON.stringify([versionInfo]), 'utf-8')
  }
} catch(e){
    console.log(e)
}